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