UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DLFlKE8WZtOTy0omH/HDt+eZYJ5g6ck970wqGZuFdDc=' 
WHERE 
  key_id = '9b814288ecbbde746f9548f3321b0618cba875691531332c9faa7678e06d6628' 
  AND (
    token = 'DLFlKE8WZtOTy0omH/HDt+eZYJ5g6ck970wqGZuFdDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036