UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oC3HWDpwnh7CWfA5XFtc8oSipnjTFGjqflFs++WlP2s=' 
WHERE 
  key_id = 'c520484ff5b239f200ac56a86f0df2ede920024f8de91920e86bd23be1baa476' 
  AND (
    token = 'oC3HWDpwnh7CWfA5XFtc8oSipnjTFGjqflFs++WlP2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052