UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sm6nUxjlXMlnQPG99RDfSkqk1c44hCVfegV52bMoLcQ=' 
WHERE 
  key_id = '25d33c4f537756e67a01fd21cf5fa87a6086a998b0f92fdabc12cb4c99db81b9' 
  AND (
    token = 'sm6nUxjlXMlnQPG99RDfSkqk1c44hCVfegV52bMoLcQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022