UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fP40cJmEMEjUEJZAPJqBy6qneMLw+i9Ay4+AOD9nszI='
WHERE
key_id = '1fe8782734813bb3534c29c51eb201c318d957b7ebf64c5ceff463ac6eed8f1e'
AND (
token = 'fP40cJmEMEjUEJZAPJqBy6qneMLw+i9Ay4+AOD9nszI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)