UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8gqX0Zgj6dr2PPiA4Six26naOnfA9HWjrLL4aa8Woow=' 
WHERE 
  key_id = '3c45a39b542a7ff962226bda29179bf74421d12c5d7d43220aad248386272a52' 
  AND (
    token = '8gqX0Zgj6dr2PPiA4Six26naOnfA9HWjrLL4aa8Woow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023