UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oUZff3iZekOGjLyn00hyfPP65djO2m+p4GsDkQ9MO7M='
WHERE
key_id = 'd1a6e0b86abf499abb8d5fe12f0591b755ddce6b653e56c3e3b2133443ba0e50'
AND (
token = 'oUZff3iZekOGjLyn00hyfPP65djO2m+p4GsDkQ9MO7M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)