UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vi8GTPVTIKt3StDJqrJjTW06EcX2OQ5OOmYjCHLj6cg=' 
WHERE 
  key_id = '88aea86a808c5ca54eafd5c0ec74212953efeb5b2caf78c9e8ba6043df01b945' 
  AND (
    token = 'vi8GTPVTIKt3StDJqrJjTW06EcX2OQ5OOmYjCHLj6cg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021