UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6OZr9Rpt7El8yWgRK69hYxzdjNynpMJTCwFg5t8DH7A='
WHERE
key_id = '523db7fc88aab161b064fe5985fce33a05b831d2e9925d4d1659d6c01c0c4b79'
AND (
token = '6OZr9Rpt7El8yWgRK69hYxzdjNynpMJTCwFg5t8DH7A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)