UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z2JqhbFtft1GvUYJim303QMSGUj2lldIzwllzEXZqOo='
WHERE
key_id = '3f340e1ba9e078628a0765745b12472ef311b41354caf5fd3508cedfc9da8120'
AND (
token = 'z2JqhbFtft1GvUYJim303QMSGUj2lldIzwllzEXZqOo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)