UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GCTcYcLH33X/+FCsJCf3j5zRpdUjt5vrjjORkWV6xLA='
WHERE
key_id = '7ffe8e49c06454a3312017b4a958bae86c9353e308f09034c5eab917f0f460ee'
AND (
token = 'GCTcYcLH33X/+FCsJCf3j5zRpdUjt5vrjjORkWV6xLA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)