UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UnpsSislPAci+huJ8kZredWROM2JkW9QpQjLlznX41M=' 
WHERE 
  key_id = '9ca91c1d0c162056d212b722e6ad405fcdcef4a03f4fba3962178f95018be3de' 
  AND (
    token = 'UnpsSislPAci+huJ8kZredWROM2JkW9QpQjLlznX41M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018