UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0jgg/sZYsn/wwvXw5NP9BO9wwlSbQjtaCs5Q2aQ9NEM='
WHERE
key_id = 'e57284238721553d323759781098ca68dafd5777e456142d01703556c6934369'
AND (
token = '0jgg/sZYsn/wwvXw5NP9BO9wwlSbQjtaCs5Q2aQ9NEM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)