UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0hVbwbWMvXuT2g9V1H7fwwwjMPHeHIafbBP8hXYsIq4='
WHERE
key_id = '38e53d5683e6eef138a753722cce42be9c8b48a1a608f969f6026013a657bca5'
AND (
token = '0hVbwbWMvXuT2g9V1H7fwwwjMPHeHIafbBP8hXYsIq4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)