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