UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IbbjmA9eVmOWVgj9wwMTKz7FF8BSC10f9g27B3mW9ck='
WHERE
key_id = 'bb4cdb846e92fba3074d196b4264eb566a9fdf56b34a06611aa46ce8ab81e1bb'
AND (
token = 'IbbjmA9eVmOWVgj9wwMTKz7FF8BSC10f9g27B3mW9ck='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)