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