UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ODJUWNttmsV1ZdMFs2MeE742XpabaTMa3ZEO4+VZ7r8='
WHERE
key_id = '0c34752ad480aba12e3bfcfed6907bab70203f6c334f876fef3d235ed58af123'
AND (
token = 'ODJUWNttmsV1ZdMFs2MeE742XpabaTMa3ZEO4+VZ7r8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)