UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Lx4XFbSOnpSreKZWmUSs9HWy9h5GBwJoWKSABc9M+oM='
WHERE
key_id = 'a0a659cf27309cef49d1df980c992bbb003e16f3c69c4aac55a54a95878cd475'
AND (
token = 'Lx4XFbSOnpSreKZWmUSs9HWy9h5GBwJoWKSABc9M+oM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)