UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd+bwO7IpmVM2vSMYWR9lPcwjlAcB1+n3J4+EbTGcfW8='
WHERE
key_id = 'e27f934e53a5b1f7004b03d07d972f66e2b587df15d7267dedbe82acd839608f'
AND (
token = 'd+bwO7IpmVM2vSMYWR9lPcwjlAcB1+n3J4+EbTGcfW8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)