UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'e3yjlfkOUpJj52hl88AFvDia1Vzk+tiq2h7Am33m1Q8='
WHERE
key_id = 'ae9b3dcd21b93f271a96e02d42de47417717744b17b6fd73b6a70edbe912afbe'
AND (
token = 'e3yjlfkOUpJj52hl88AFvDia1Vzk+tiq2h7Am33m1Q8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)