UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PhKD0OYNc1DK1+P43GursOKPGjHwN92YDd36SMX7/Nw='
WHERE
key_id = 'aa1ba752e903319f8f98084c34844a45be4da3aca95ff3f75f2ba9785d97a028'
AND (
token = 'PhKD0OYNc1DK1+P43GursOKPGjHwN92YDd36SMX7/Nw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)