UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TBm8Gp2yuIguxQ6YVn5SVTp2FAxrR/k+3Dv0E0ReX34=' 
WHERE 
  key_id = '64f0d552a047500d50afac01b089829a0d79e2a6aef0186a7b9eda20766a83e6' 
  AND (
    token = 'TBm8Gp2yuIguxQ6YVn5SVTp2FAxrR/k+3Dv0E0ReX34=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055