UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZAxyrOZAXIDBFF/8wENFhZbtlv4Q5T3E3P1+8d8iKks='
WHERE
key_id = 'a2b02685ffc99a749a120d5146be851076c5b1ea71f3a0015768b90026dd90dd'
AND (
token = 'ZAxyrOZAXIDBFF/8wENFhZbtlv4Q5T3E3P1+8d8iKks='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)