UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iod6FMwynBEWXFwA5/M51SXD+nvqSPXZq1kqdrz9s6E='
WHERE
key_id = 'da22932fb4d3c4e770389926151f5b684a51caf207d68d427df0b2f73fb929aa'
AND (
token = 'iod6FMwynBEWXFwA5/M51SXD+nvqSPXZq1kqdrz9s6E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)