UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I4x41mXX9qZX57RQMLvoxrR55N2snncEJL1ZPMu/Ybc=' 
WHERE 
  key_id = 'a7694c36a897bc9e0c40c22a8ecab66f40f0e511d9398d5a572cb953134c2786' 
  AND (
    token = 'I4x41mXX9qZX57RQMLvoxrR55N2snncEJL1ZPMu/Ybc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032