UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c9gYlduxxmk3gA1Fu6BRP7YhhYlE5rtpXqggIxkop4A=' 
WHERE 
  key_id = '000cc881cbd21461be4c8d05a0bea92b1c1d21de662d1046869c795cead08681' 
  AND (
    token = 'c9gYlduxxmk3gA1Fu6BRP7YhhYlE5rtpXqggIxkop4A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028